  
  		var x=1;y=1;//定义两组开关
		/*页面右上方按钮搜索 在浮动窗指定一个方法*/
	 	$(".searIco").on("click",function(){
	 		if(x==1){
	 			appcan.window.evaluatePopoverScript("","content","demo()");
	 			x=0;

	 		}else{
	 			appcan.window.evaluatePopoverScript("","content","closeDemo()");
         		x=1;
	 		}
        })
      	/*打开弹窗以及 打开一个遮罩的方法*/
   		function demo(){
         	$(".full_page").css("display","block");
         	$(".open_box").css("display","block");
         	appcan.window.disableBounce();
        }
        //搜索弹窗关闭的方法:
        function closeDemo(){
        	$(".full_page").css("display","none");
         	$(".open_box").css("display","none");
         	appcan.window.enableBounce();
        }
        /*打开排序模态框的一个方法*/
        //点击排序按钮  打开排序模态框
        $(".sortIco").on("click",function(){
        	if(y==1){
        			appcan.window.evaluatePopoverScript("","content","pageSort()");
        			y=0;
        	}else{
        		appcan.window.evaluatePopoverScript("","content","closePageSort()");
        		y=1;
        	}

        })
        /*右上方排序模态框 打开的一个方法*/
        function pageSort(){
        	$(".open_box").css("display","none");
        	$(".pageSort").removeClass("closePage");
        	$(".full_page").css("display","none");
        }



        //排序模态框 主页关闭方法
        function closePageSort(){
        	$(".pageSort").addClass("closePage");
        	$(".full_page").css("display","none");
        }
        //排序模态框排序方法;
        //定义两个状态；
        //按照计飞时间排序
        function stdSort(){
        	appcan.locStorage.setVal("stdSort","asc");
        	appcan.locStorage.setVal("etdSort","");//按照计飞排序  改变本地存储的预飞排序值;
        	$(".pageSort").addClass("closePage");
        	index=1;
   			FlightList(1);
        }
        //按照预飞排序
        function etdSort(){
        	appcan.locStorage.setVal("etdSort","asc");
        	appcan.locStorage.setVal("stdSort","");//清空本地存储的 计飞值
        	$(".pageSort").addClass("closePage");
        	index=1;
   			FlightList(1);
        }
        //搜索模态框 点击搜索执行脚本;
        $(".sear_b").on("click",function(){
        	appcan.window.enableBounce();
        	var strCity =$(".strCity").text();
        	// alert(strCity);
        	var deptAirport=$(".strCity").attr("CT_CODE");
	  		var startDate=$("#startDate").text();//获取起始时间 
	  		var endDate=$("#endDate").text();	
	  		// alert(endDate);
	  		//获取所选下拉选项:
	  		var options=$("#select>option:selected").val();
	  		var FlightNo=$(".hb_num>input").val();//用户输入的航班号码
	  		//更改本地存储的值
	  		appcan.locStorage.setVal("deptAirport",deptAirport);
	  		appcan.locStorage.setVal("startDate",startDate);
	  		appcan.locStorage.setVal("endDate",endDate);
	  		appcan.locStorage.setVal("isFly",options);
	  		appcan.locStorage.setVal("FlightNo",FlightNo);
	  		appcan.locStorage.setVal("stdSort","asc");//页面默认按照计飞时间  升序
            appcan.locStorage.setVal("etdSort","");//预飞时间 默认不选择；
            appcan.locStorage.setVal("isSearch","true");//如果数据搜索了   保存一个状态
	  		$(".pageSort").addClass("closePage");
	  		$(".open_box").css("display","none");
        	$(".full_page").css("display","none");
        	appcan.locStorage.setVal("strCity",strCity);
        	appcan.locStorage.remove("ready");
        	//回到初始页面  第一页
        	index=1;
   			FlightList(1);
        });
        /*当点击搜索模态框外部的时候  遮罩消失 模态框消失  排序模态框消失*/
        $(".full_page").on("click",function(){
        	$(this).css("display","none");
        	$(".open_box").css("display","none");
        	$(".pageSort").addClass("closePage");
        	appcan.window.enableBounce();
        })

        //点击城市搜索 进入一个选择页面
        $(".city_search p").on("click",function(){
        	uexWindow.open("airport_select", 0, "airport_select.html", 2, "", "", 0);
        })
        /*航站选择完毕以后的一个回调方法*/
        function citySelect(){
        	//获取本地存储的航站信息 以及航站三字码
        	var cityName=appcan.locStorage.getVal("airportName");
        	var cityCode=appcan.locStorage.getVal("airportCode");
        	$(".city_search p").text(cityName);
        	$(".city_search p").attr("CT_CODE",cityCode);
        }
        /*页面日期选择*/
          var iG = {};
		/* 操作日期
		---------------------------------------------------------------------------------------*/
		//获取年
		iG.getYear = function(date){
		    if(date == undefined) date = new Date;
		    return date.getFullYear();
		};
		//获取月
		iG.getMonth = function(date){
		    if(date == undefined) date = new Date;
		    var month = date.getMonth() + 1;
		    if(month < 10) month = "0" + month;
		    return month;
		};
		//获取日
		iG.getDay = function(date){
		   if(date == undefined) date = new Date;
		    var day = date.getDate();
		    if(day < 10) day = "0" + day;
		    return day;
		};

		//获取当前日期
		iG.getDateToday = function(date){
		    return iG.getYear() + "-" + iG.getMonth() + "-" + iG.getDay();
		};
		//获取星期
		iG.getWeek = function(date){
		    if(date == undefined) date = new Date;
		    var week = date.getDay();
		    var weekArr = ["日","一","二","三","四","五","六"];
		    return weekArr[week];
		};
		//获取小时
		iG.getHours = function(date){
		    if(date == undefined) date = new Date;
		    return date.getHours();
		},
		//获取分钟
		iG.getMinutes = function(date){
		    if(date == undefined) date = new Date;
		    return date.getMinutes();
		};
		$(function(){
		        var ED_D = ST_D = iG.getYear() + "-" + iG.getMonth() + "-" + iG.getDay();
		        $("#startDate").on("tap", getStratDate);
		        $("#endDate").on("tap", getEndDate);
		        //获取开始时间
		        function getStratDate() {
		            if(! $('#startDate').attr('ST_D')){
		                var datese = {
		                    year : iG.getYear(),
		                    month : iG.getMonth(),
		                    day : iG.getDay()
		                 }
		                $('#startDate').attr('ST_D', JSON.stringify(datese));
		            }
		            var that = $(this);
		            var date = JSON.parse($("#startDate").attr("ST_D"));
		            uexControl.openDatePicker(date.year, date.month, date.day);
		            uexControl.cbOpenDatePicker = function(opCode, dataType, data) {
		                var endD = $('#endDate').text();
		                //console.log(endD);
		                if (dataType == 1){
		                    data = eval('(' + data + ')');
		                }
		                if (ED_D.split("-")[0] > data.year | (ED_D.split("-")[0] == data.year & ED_D.split("-")[1] > data.month) | (ED_D.split("-")[0] == data.year & ED_D.split("-")[1] == data.month & ED_D.split("-")[2] >= data.day)) {
		                        setDate_s(that, data.year, data.month, data.day);
		                        ST_D = data.year + '-' + data.month + '-' + data.day;
		                }else{
		                    appcan.window.openToast('开始日期不能大于结束日期',3000,5,0);
		                    return;
		                } 
		                    //IC.talkingDataCount("集团客户", "0010");
		            }
		            setDate_s = function(elem, year, month, day){
		                var month = Number(month);
		                var day = Number(day);
		                var months,
		                    days;
		                months = month >= 10 ? "" + month : "0" + month;
		                days = day >= 10 ? "" + day : "0" + day;
		                var json = {
		                    "year" : year,
		                    "month" : months,
		                    "day" : days,
		                };
		                $("#startDate").attr("ST_date", year + "-" + months + "-" + days);
		                $('#startDate').attr('ST_D', JSON.stringify(json));
		                $("#startDate").text(year + "-" + months + "-" + days);
		               // console.log(year + "-" + months + "-" + days);
		            };
		        }
		        // 获取结束时间
		        function getEndDate(){
		            if(!$("#endDate").attr("ED_D")){
		                var datase = {
		                year : iG.getYear(),
		                month : iG.getMonth(),
		                day : iG.getDay()
		            }
		            $("#endDate").attr("ED_D", JSON.stringify(datase));
		            }
		            var that = $(this);
		            var date = JSON.parse($("#endDate").attr("ED_D"))
		            uexControl.openDatePicker(date.year, date.month, date.day);
		            uexControl.cbOpenDatePicker = function(opCode, dataType, data){
		                if (dataType == 1){
		                        data = eval('(' + data + ')');
		                }
		                if (ST_D.split("-")[0] > data.year | (ST_D.split("-")[0] == data.year & ST_D.split("-")[1] > data.month) | (ST_D.split("-")[0] == data.year & ST_D.split("-")[1] == data.month & ST_D.split("-")[2] > data.day)){
		                        appcan.window.openToast("结束时间不能小于开始时间", 3000, 5, 0);
		                        return;
		                }else{
		                        setDate_s(that, data.year, data.month, data.day);
		                        ED_D = data.year + "-" + data.month + "-" + data.day;
		                }
		            }
		            setDate_s = function(elem, year, month, day){
		                var month = Number(month);
		                var day = Number(day);
		                var months,days;
		                months = month >= 10 ? "" + month : "0" + month;
		                days = day >= 10 ? "" + day : "0" + day;
		                var json = {
		                    "year" : year,
		                    "month" : months,
		                    "day" : days,
		                };
		                $("#endDate").attr("ED_date", year + "-" + months + "-" + days);
		                $("#endDate").attr("ED_D", JSON.stringify(json));
		                $("#endDate").text(year + "-" + months + "-" + days);
		            };
		        }
		});
	  	//数据请求的方法:
	  	// var path="http://mgstest.ceair.com:8080/mpservice/"; //uat 地址
	  	//var path="http://172.31.3.190:8080/mpservice/"; //测试地址

	  	var path="http://mpservice.ceair.com/mpservice/"//生产地址
	  	//定义一个定时器集合
	  	var TimerTask={};// 屏幕未解锁情况下定时器集合
	  	var lockTimerTask={};//屏幕锁屏下的集合;
	  	function FlightList(pageNo){
	  		//获取本地存储
	  		var url=path+"platinum_getFlightInfoListAndPlatinumCardNum.action?";
	  		var deptAirport=appcan.locStorage.getVal("deptAirport");//获取本地存储的航站名称
	  		if(deptAirport==null){
	  			deptAirport="SHA";
	  		}
	  		var startDate=appcan.locStorage.getVal("startDate");//获取本地存储的开始时间
	  		var endDate=appcan.locStorage.getVal("endDate");//获取本地存储的结束时间;
	  		var FlightNo=appcan.locStorage.getVal("FlightNo");//获取本地存储的航班号
	  		var isFly=appcan.locStorage.getVal("isFly");
	  		//获取本地储存的排序方式;
	  		var stdSort=appcan.locStorage.getVal("stdSort");//按计飞排序
	  		var etdSort=appcan.locStorage.getVal("etdSort");//按预计飞行排序
	  		url=url+"deptAirport="+deptAirport+"&startDate="+startDate+"&endDate="+endDate+"&pageNo="+pageNo+"&FlightNo="+FlightNo+"&isFly="+isFly+"&stdSort="+stdSort+"&etdSort="+etdSort;
	  		appcan.window.openToast("请稍后....","",5,1);

	  		//每次请求默认清除 锁屏产生的闹钟;
	  		for(var each in lockTimerTask){
				clearTimeout(lockTimerTask[each]);
			}
	  		$.ajax({
	  			url:url,
	  			type:"GET",
	  			data:"",
	  			dataType:"JSON",
	  			success:function(data){
	  				console.log(data);
	  				appcan.locStorage.remove("setBounce");
	  				//当在第一个 并且没有锁屏的时候
	  				if(pageNo==1){
	  					//清除当前页面全部定时器 
	  					for(var each in TimerTask){
						    clearTimeout(TimerTask[each]);
						}
						//当页面在第一页的时候 先清空本地航班升舱时间状态  重新放存储
						appcan.locStorage.remove("upGradesList");
	  				}
	  				var isSearch=appcan.locStorage.getVal("isSearch");
	  				var ready=appcan.locStorage.getVal("ready");
	  				var pullDown=appcan.locStorage.getVal("pullDown");
	  				if(data.length==0){
	  					if(ready=="true"||pullDown=="true"){
	  						var res=$("<div class='ub ub-ac ub-pc' style='margin-top:1em'>无今日未起飞航班信息,请查询其他航班.....</div>");
	  						$(".page_box").html(res);
	  						appcan.window.closeToast();
	  						appcan.locStorage.remove("ready");
	  						return false;

	  					}
	  					else if(isSearch=="true"){
	  						var res=$("<div class='ub ub-ac ub-pc' style='margin-top:1em'>没有查询到相关航班信息,请检查搜索条件....</div>");
	  						$(".page_box").html(res);
	  						appcan.locStorage.remove("isSearch");
	  						appcan.window.closeToast();
	  						return false;
	  					}else{
	  						appcan.window.openToast("数据加载完毕....",2000,5,0);
	  						return false;
	  					}
	  				};


	  				appcan.window.closeToast();
	  				appcan.locStorage.remove("isSearch");
	  				appcan.locStorage.remove("ready");
	  				appcan.locStorage.remove("pages");
	  				appcan.locStorage.remove("pullDown");
	  				//清除 锁屏存储下的状态;
	  				appcan.locStorage.remove("lockScreen");
	  				var dom="";//定义一个显示元素的变量;
	  				//初始化一个提醒事项  包括提醒的升舱航班  以及手动升舱时间
	  				var upGradesList=appcan.locStorage.getVal("upGradesList");//获取本地航班信息
	  				if(!upGradesList){
	  					//当不存在这个本地存储的时候 
	  					upGradesList="";
	  				}else{
	  					upGradesList=JSON.parse(upGradesList);
	  				}
	  				for(var i =0;i<data.length;i++){
	  					// console.log(typeof data[i]);
	  					// console.log(JSON.stringify(data[i]));
	  					var flightNo=data[i].FlightNo;//获xA取纯数字航班号；
	  					var CarrierNo=data[i].Carrier+data[i].FlightNo;//获取航班号
	  					var Carrier=data[i].Carrier;//获取航空公司名称
	  					var FleetCode=data[i].FleetCode;//航班机型;
	  					var DeptAirportCN=data[i].DeptAirportCN; //起飞城市航站;
	  					var ArrAirportCN=data[i].ArrAirportCN;//到达城市航站;
	  					var deptAirport=data[i].DeptAirport;//起飞航站三字码
	  					var arrAirport=data[i].ArrAirport;//到达城市三字码;
	  					var flightDate=data[i].FlightBJDate;//原来的日期格式
	  					// console.log(flightDate);
	  					var FlightBJDate=(data[i].FlightBJDate).replace(/-/g,"/");//飞行日期； 替换字符窜的格式
	  					var STD=(data[i].STD).substr(11,5);//计划起飞时间 截取时间与分钟
	  					var STA=(data[i].STA).substr(11,5);//计划到达时间；
	  					var ETA=(data[i].ETA).substr(11,5);//预计到达时间；
	  					var ETD=(data[i].ETD).substr(11,5);//预计起飞时间;
	  					var ATA=(data[i].ATA);//实际到达时间
	  					var ATD=(data[i].ATD);//实际起飞时间;
	  					//修改格式
	  					ATA=(ATA==null||ATA=="")?"---":ATA.substr(11,5);
	  					ATD=(ATD==null||ATD=="")?"---":ATD.substr(11,5);
	  					var PlatinumCardNum=data[i].PlatinumCardNum;//白金卡旅客升舱数量;
	  					var flightStatus=data[i].flightStatus;
	  					// 获取前序航班编号以及 时间日期
	  					var QXFlightNo=data[i].QXFlightNo;//前序航班
	  					//console.log(QXFlightNo);
	  					var QXFlightDate=((data[i].QXFlightDate).substr(0,10)).replace(/-/g,"/");//前序航班日期
	  					//console.log(QXFlightDate);
	  					var QXETA=(data[i].QXETA !==""&&data[i].QXETA !==null)?((data[i].QXETA).substr(11,5)):"---";//前序预飞  并且改变各式;
	  					//console.log(QXETA);
	  					var QXETD=(data[i].QXETD !==""&&data[i].QXETD!==null)?((data[i].QXETD).substr(11,5)):"---";//前序预到时间
	  					var QXSTA=(data[i].QXSTA !==""&&data[i].QXSTA!==null)?((data[i].QXSTA).substr(11,5)):"---";//前序航班 计划到达时间
	  					var QXSTD=(data[i].QXSTD !==""&&data[i].QXSTD!==null)?((data[i].QXSTD).substr(11,5)):"---";//前序航班 计划飞行时间;
	  					var QXATA=(data[i].QXATA !==""&&data[i].QXATA!==null)?((data[i].QXATA).substr(11,5)):"---";//前序航班 实际到达时间
	  					var QXATD=(data[i].QXATD !==""&&data[i].QXATD!==null)?((data[i].QXATD)).substr(11,5):"---";//前序航班  实际起飞时间
	  					//console.log(QXATA);
	  					var tips,tips2;//定义两条字符 
	  					var QXFlightNo=(data[i].QXCarrier)+(data[i].QXFlightNo);
	  					var isManual=data[i].isManual;
	  					var settingAutoTime=data[i].settingAutoTime;
	  					if(settingAutoTime !=undefined&&settingAutoTime!="undefined"&&settingAutoTime!=null&&settingAutoTime!="null"){
	  						var setAutime=settingAutoTime.replace(" ","T");
	  					}
	  					// console.log(settingAutoTime.replace(" ","T"));
	  					var autoTimeH=(!settingAutoTime||settingAutoTime=="undefined"||settingAutoTime=="")?"---":settingAutoTime.substr(11,2);
	  					var autoTimeM=(!settingAutoTime||settingAutoTime=="undefined"||settingAutoTime=="")?"---":settingAutoTime.substr(14,2);
	  					var tabClass="";//定义按钮的样式
	  					if(isManual == false){	
	  						tabClass="tab_on";
	  					}else{
	  						tabClass="tab_off";
	  						if(settingAutoTime&&settingAutoTime!="undefined"){
	  							//naozhong(CarrierNo,settingAutoTime);
			  					if(!upGradesList){
			  						upGradesList={};
			  						upGradesList[CarrierNo]=settingAutoTime;
			  					}else{
			  						upGradesList[CarrierNo]=settingAutoTime;
			  					}
	  						}
	  					}
	  					if(QXFlightNo==""&&QXFlightDate==""){ 
	  						//当前序航班没有数据的时候:
	  						var QX_tips='<div class="ub ub-ac ub-pc " style="width:100%;padding:.5em 0">'
	  										+'<p>无</p>'
				                    	+'</div>'
	  					}else{
	  						//判断当前航班起时间状态
	  						if(QXATD !=="---"){
	  							tips="实飞 "+QXATD;
	  							tips2="实到 "+QXATA;
	  						}else if(QXETD !=="---"){
	  							tips="预飞 "+QXETD;
	  							tips2="预到 "+QXETA;
	  						}else if(QXSTD !=="---"){
	  							tips="计飞 "+QXSTD;
	  							tips2="计到 "+QXSTA;
	  						}
	  						var QX_tips='<div style="width:100%">'
				                        	+'<p>前序: '+QXFlightNo+'</p>'
				                    	+'</div>'
				                    	+'<div class="ub ub-ac" style="width:100%;padding:.5em 0">'
				                        	+'<div style="width:30%">'
				                            	+tips
				                        	+'</div>'
				                        	+'<div style="width:30%">'
				                            	+QXFlightDate
				                        	+'</div>'
				                        	+'<div style="width:30%">'
				                            	+tips2
				                        	+'</div>'
				                    	+'</div>'
	  					}
	  					dom+='<div class="page_select">'
					        	+'<div class="page_1 ub" onclick="userInfo(\''+PlatinumCardNum+'\',\''+flightNo+'\',\''+flightDate+'\',\''+Carrier+'\',\''+deptAirport+'\',\''+arrAirport+'\')">'
					        		+'<div class="page_left ub ub-ver">'
					        			+'<div class="hb_title ub">'
					        				+'<span>'+CarrierNo+'</span>&nbsp;'
					        				+'<i>'+FleetCode+'</i>'
					        			+'</div>'
					        			+'<div class="page_list ub ub-ver">'
					        				+'<div  class="ub ub-ac" style="min-height:2.5em">'
					        					+'<div class="page_l" >'
					        						+DeptAirportCN
					        					+'</div>'
					        					+'<div class="page_m fly_log ub ub-ac ub-pc" >'
					        						+'<div class="fly_bg_line">'
					        							
					        						+'</div>'
					        						+'<div class="fl_img">'
					        						+'</div>'
					        					+'</div>'

					        					+'<div class="page_r ub ub-pe" >'
					        						+ArrAirportCN
					        					+'</div>'
					        				+'</div>'
					        				+'<div class="ub ub-ae" style="min-height:2em">'
					        					+'<div class="page_l patxt ub ub-ac">'
					        						+'计飞'+STD
					        					+'</div>'
					        					+'<div class="page_m patxt ub ub-ac ub-pc">'
					        						+FlightBJDate
					        					+'</div>'
					        					+'<div class="page_r patxt ub ub-ac ub-pe" >'
					        						 +'计到'+STA
					        					+'</div>'
					        				+'</div>'
					        				+'<div class="ub ub-ae" style="min-height:2em">'
					        					+'<div class="page_l patxt ub ub-ac" >'
					        						+'预飞<i>'+ETD+'</i>'
					        					+'</div>'
					        					+'<div class="page_m patxt ub ub-ac ub-pc" >'
					        						+flightStatus
					        					+'</div>'
					        					+'<div class="page_r patxt ub ub-ac ub-pe" >'
					        						+'预到<i>'+ETA+'</i>'
					        					+'</div>'
					        				+'</div>'
					        				+'<div class="ub ub-ae" style="min-height:2em">'
					        					+'<div class="page_l patxt ub ub-ac" >'
					        						+'实飞<i>'+ATD+'</i>'
					        					+'</div>'
					        					+'<div class="page_m patxt ub ub-ac ub-pc" >'
					        					+'</div>'
					        					+'<div class="page_r patxt ub ub-ac ub-pe" >'
					        						+'实到<i>'+ATA+'</i>'
					        					+'</div>'
					        				+'</div>'
					        			+'</div>'
					        		+'</div>'

					        		+'<div class="page_right ub ub-ver" >'
					        			+'<div class="cv_nums ub ub-ac ub-pc">'
					        			+'</div>'
					        			+'<div class="ub ub-ver ub-f1" >'
						        			+'<div class="ub ub-ac ub-pc" style="height:5.05em">'
						        				+'<p>'+PlatinumCardNum+'</p>'
						        			+'</div>'
						        			+'<div class="ub ub-ae ub-pc" style="font-size:.8em;height:2.1em">'
						        				+'白金卡升舱'
						        			+'</div>'
					        			+'</div>'
					        		+'</div>'
					        	+'</div>'
					        	+'<div class="QX_tips ub ub-ver ub-ac ub-pc">'
				                   +QX_tips
				                   +'<div class="bg_top"></div>'
				                   +'<div class="bg_bottom"></div>'
				                +'</div>'
				                +'<div class="change_btn ub ub-ac ub-pc">'
				                    +'<div  class="ub ub-f1 ub-ac">'
				                       +'<div>'
				                           +'自动升舱:'
				                            +'&nbsp;'
				                       +'</div>'
				                        +'<div class="tab_ses tab_on '+tabClass+' ub ub-ac " deptAirport=\''+deptAirport+'\' arrAirport=\''+arrAirport+'\' flightDate=\''+flightDate+'\' flightNo=\''+flightNo+'\' carrier=\''+Carrier+'\'  isManual=\''+isManual+'\'  settingAutoTime=\''+setAutime+'\'  onclick="tabBtn(this)">'
				                        +'</div>'
				                    +'</div>'
				                    +'<div   class="ub ub-f1 ub-ac ub-pe">'
				                        +'<div>'
				                           +'升舱时间:'
				                           +'&nbsp;'
				                        +'</div>'
				                        +'<div class="sc_time ub ub-ac ub-pc" st_t="" arrAirport=\''+arrAirport+'\'>'
				                            +'<div class="ub ub-ac ub-pc">'
				                                +'<i class="autoTimeH">'+autoTimeH+'</i>'
				                            +'</div>'
				                            +'<div class="ub ub-ac ub-pc">'
				                                +'<i class="autoTimeM">'+autoTimeM+'</i>'
				                            +'</div>'
				                        +'</div>'
				                    +'</div>'
				                +'</div>'
			        		+'</div>';	
			        }
			        res=JSON.stringify(upGradesList);
	  				appcan.locStorage.setVal("upGradesList",res);
			        if(pageNo<=1){
	  						$(".page_box").html(dom);//页面在第一页的时候 显示第一页内容

	  				}else{	
	  					$(".page_box").append(dom);//页面加载超过第一页  页面数据累计;
	  				}
		   		//人工干预  时间选择;
			   		$(".sc_time").click(function(){
			            if(!$(this).attr('st_t')){
			            	//获取默认的日期
			            	var hour=$(this).find(".autoTimeH").text();
			            	var min=$(this).find(".autoTimeM").text();
			            	if(hour!="---"&& min!="---"){
			            		 var datese = {
				                    hour : hour,
				                    minute: min,
				                 }
				             }else{
				             	 var datese = {
				                    hour : iG.getHours(),
				                    minute: iG.getMinutes(),
				             	}
			           		 }
			           		 $(this).attr("st_t", JSON.stringify(datese));
			        	}
			            var that=$(this);
	           			var date = JSON.parse($(this).attr("st_t"));
	           			//从显示的时间来选择默认的时间;
			            uexControl.openTimePicker(Number(date.hour),Number(date.minute));
			            uexControl.cbOpenTimePicker = function(opCode,dataType,data) {
			             	  if (dataType == 1) {
			                    data = eval('(' + data + ')');
			                	} ;
			                	var hour=data.hour;
			                	var minute=data.minute;
			           			setDate_s(that, data.hour, data.minute);
			            }
			            setDate_s = function(elem, hours, minutes) {
				                var hours = Number(hours);
				                var minutes = Number(minutes);
				                var minutes,
				                    hours;
				                minutes = minutes >= 10 ? "" + minutes : "0" + minutes;
				                hours = hours >= 10 ? "" + hours : "0" + hours;
				                var json = {
				                    "hour" : hours,
				                    "minute" : minutes,
				                };
				                elem.attr("st_t",JSON.stringify(json));
				            	elem.find(".autoTimeH").html(hours);
				            	elem.find(".autoTimeM").html(minutes);
				            	var Pele=elem.parent().parent();
				            	var deptAirport=Pele.find(".tab_ses").attr("deptAirport");//获取航站信息;
				            	var arrAirport=Pele.find(".tab_ses").attr("arrAirport");//获取出发航站;
				            	var flightDate=Pele.find(".tab_ses").attr("flightDate");//获取航班日期
				            	var flightNo=Pele.find(".tab_ses").attr("flightNo");//获取航班号
				            	var carrier=Pele.find(".tab_ses").attr("carrier");//获取承运人
				            	var isManuals=Pele.find(".tab_ses").attr("isManual");//获取干预状态;
				            	Pele.find(".tab_ses").attr("settingautotime",flightDate+"T"+hours+":"+minutes+":00");
				            	var settingautotime=Pele.find(".tab_ses").attr("settingautotime");
				            	Usersetting(deptAirport,arrAirport,flightDate,flightNo,carrier,isManuals,settingautotime);
				            };
			   		});
	  			},
	  			error:function(data){
	  				console.log(url);
	  				console.log(data);
	  				appcan.window.openToast("请求超时,请检查网络....",2000,5,0);
	  				appcan.locStorage.remove("setBounce");//清除刷新状态
	  				appcan.locStorage.remove("ready");
	  				appcan.locStorage.remove("isSearch");
	  			},
	  		})
 	  	}
 	  	/*页面右侧  白金卡升舱数量点击 进入用户详情*/
   			function userInfo(a,flightNo,flightDate,Carrier,dep,arr){
   				appcan.locStorage.setVal("PlatinumCardNum",a);//保存升舱旅客的数量到本地;
   				appcan.locStorage.setVal("flightNo",flightNo);//获取本地存储的航班号码
   				appcan.locStorage.setVal("flightDate",flightDate);//获取本地存储的飞行时间;
   				appcan.locStorage.setVal("Carrier",Carrier);//保存航空公司名称;
   				appcan.locStorage.setVal("dep",dep);//保存起飞航站三字码
   				appcan.locStorage.setVal("arr",arr);//到达航站三字码
   				if(a<=0){
   					appcan.window.openToast("暂无升舱旅客,请稍后再试...",2000,5,0);
   					return;
   				}else{
   					for(var each in TimerTask){
						 clearTimeout(TimerTask[each]);
					}
						//当页面在第一页的时候 先清空本地航班升舱时间状态  重新放存储
					appcan.locStorage.remove("upGradesList");
   					appcan.window.open("scDetail","scDetail.html","10");
   					//uexWindow.open("scDetail", 0, "scDetail.html", 2, "", "", 0);
   				}
   		}
   		/*页面初始化:*/
   		function reflog(){
   			index=1
   			FlightList(index);
   		}
   		function tabBtn(a){
  				var deptAirport=$(a).attr("deptAirport");
  				var arrAirport=$(a).attr("arrAirport");
  				var flightDate=$(a).attr("flightDate");
  				var flightNo=$(a).attr("flightNo");
  				var carrier=$(a).attr("carrier");
  				var isManual=$(a).attr("isManual");
  				var settingAutoTime=($(a).attr("settingAutoTime")!="undefined")?$(a).attr("settingAutoTime"):"";
  				if(isManual=="false"){
  					$(a).attr("isManual","true");
  				}else{
  					$(a).attr("isManual","false");
  				}
  				$(a).toggleClass("tab_off");
  				var isManuals=$(a).attr("isManual");
  				Usersetting(deptAirport,arrAirport,flightDate,flightNo,carrier,isManuals,settingAutoTime);
   		}
   		//人工共干预的 请求方法
   		function Usersetting(de,arr,fl,flN,car,isM,seT){
   			appcan.window.openToast("操作中...","",5,1);
   			var loginName=localStorage['MU30-lOGIN-USRNAME'];//获取当前登录的用户名;
      			//var loginName="chengcheng1";
   			var sets=seT.replace(" ","T");
   			var url=path+"platinum_updateFlightDynamicf.action?deptAirport="+de+"&arrAirport="+arr+"&flightDate="+fl+"&flightNo="+flN+"&carrier="+car+"&isManual="+isM+"&settingAutoTime="+sets+"&loginName="+loginName;
   			// var url="http://172.31.3.190:8080/mpservice/platinum_updateFlightDynamicf.action?deptAirport="+de+"&arrAirport="+arr+"&flightDate="+fl+"&flightNo="+flN+"&carrier="+car+"&isManual="+isM+"&settingAutoTime="+seT+"";
   			//console.log(url);
   			$.ajax({
   				url:url,
   				data:"",
   				type:"GET",
   				dateType:"JSON",
   				success:function(data){
   					console.log(loginName);
   					appcan.window.closeToast();
   					if(data ==1){
   						appcan.window.alert("提示","操作成功","确定",function(){
   							index=1;
   							FlightList(index);
   						});
   					}else{
   						appcan.window.alert("提示","抱歉，您无权限做此操作","确定",function(){
   							index=1;
   							FlightList(index);
   						})
   					}
   				},
   				error:function(XMLHttpRequest, textStatus, errorThrown){
   					console.log(XMLHttpRequest.status);//HTTP状态码;
   					console.log(XMLHttpRequest.responseText);//服务器响应返回的文本文本信息
   					console.log(textStatus);//返回状态;
   					console.log(errorThrown);//服务器抛出的错误信息
   					appcan.window.openToast("无法连接到服务器，请稍后再试...",2000,5,0);
   				},
   			})
   		}
   		//开启闹钟的方法;
   	// 	function naozhong(flNo,setAtime,d){
   	// 		//将页面中的手动升舱时间转化成时间戳
   	// 		var newSet=setAtime.replace(/-/g, '/'); 
   	// 		var set=Date.parse(newSet);
   	// 		//获取当前时间
   	// 		var dates=new Date();
   	// 		var autoTimes=dates.getTime();//获取当前时间戳
   	// 		//当手动升舱时间大于当前的时间 代表没有过时间 开启提醒
   	// 		if(set>=autoTimes){
   	// 			var t=set-autoTimes;//获取时间差
				// var upset=new Date(set);
				// var hours=upset.getHours();
		  //  		var minutes=upset.getMinutes();
		  //  		hours=(hours<10)?"0"+hours:hours;
		  //  		minutes=(minutes<10)?"0"+minutes:minutes;
		  //  		var tips="今日航班:"+flNo+","+hours+":"+minutes+"可以开始手动升舱";
		  //  		var lockScreen=appcan.locStorage.getVal("lockScreen");
		  //  		//当在锁屏状态下的时候 创建一个锁屏状态下闹钟集合;
		  //  		if(lockScreen=="true"){
		  //  			lockTimerTask[flNo]=setTimeout(function(){
	   // 					uexDevice.vibrate("20000");
				//         uexAudio.open("res://lingsheng.mp3");
				//         uexAudio.play(-1);
				//         appcan.window.alert("提示",tips,"确定",function(){
				//         	uexAudio.stop();
				//         	uexDevice.cancelVibrate();
				//         })
	   // 				},t);
		  //  		}else{
		  //  			//非锁屏状态下的时候;
		  //  			TimerTask[flNo]=setTimeout(function(){
	   // 					uexDevice.vibrate("20000");
				//         uexAudio.open("res://lingsheng.mp3");
				//         uexAudio.play(-1);
				//         appcan.window.alert("提示",tips,"确定",function(){
				//         	uexAudio.stop();
				//         	uexDevice.cancelVibrate();
				//         })
	   // 				},t);
		  //  		}
   	// 		}
   	// 	}
   		//锁屏监听的方法;
    //     function onSuspend(){
    //     	//锁屏的时候  社会一个本地存储;
    //     	appcan.locStorage.setVal("lockScreen","true");
	  	//  	if(upGradesList&&upGradesList!="undefined"){
	  	//  		var upobj=JSON.parse(upGradesList);
	  	//  		//先清空醒屏状态的闹钟提醒
	  	// 		for(var each in TimerTask){
				// 	clearTimeout(TimerTask[each]);
				// }
				// //锁屏状态下 创建闹钟另外的闹钟提醒;
	  	// 		for(var j in upobj){
	  	// 			var flN=j;//以key 当做航班号
	  	// 			var upTimes=upobj.j;
	  	// 			naozhong(flN,upTimes);
	  	// 		}
	  	// 	}
    //     }












   		
   		









	   		
   		



